From: kfraser@localhost.localdomain Date: Wed, 18 Oct 2006 18:14:34 +0000 (+0100) Subject: Replace test-gcc-flag with Linux-style cc-option. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15589^2~36 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=f9038804d68bc97bfe33ded8e0b3b761689d6530;p=xen.git Replace test-gcc-flag with Linux-style cc-option. Improve on Linux implementation by looking for any output on stdout/stderr. This indicates badness. Signed-off-by: Keir Fraser --- diff --git a/Config.mk b/Config.mk index e626a26283..4cd113d905 100644 --- a/Config.mk +++ b/Config.mk @@ -26,7 +26,10 @@ EXTRA_INCLUDES += $(EXTRA_PREFIX)/include EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR) endif -test-gcc-flag = $(shell $(1) -v --help 2>&1 | grep " $(2) " >/dev/null 2>&1 && echo $(2)) +# cc-option +# Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586) +cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \ + /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;) ifneq ($(debug),y) CFLAGS += -DNDEBUG @@ -42,8 +45,8 @@ CFLAGS += -Wall -Wstrict-prototypes # result of any casted expression causes a warning. CFLAGS += -Wno-unused-value -HOSTCFLAGS += $(call test-gcc-flag,$(HOSTCC),-Wdeclaration-after-statement) -CFLAGS += $(call test-gcc-flag,$(CC),-Wdeclaration-after-statement) +HOSTCFLAGS += $(call cc-option,$(HOSTCC),-Wdeclaration-after-statement,) +CFLAGS += $(call cc-option,$(CC),-Wdeclaration-after-statement,) LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i)) diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile index ae031e96d4..cb740a7d55 100644 --- a/tools/firmware/hvmloader/Makefile +++ b/tools/firmware/hvmloader/Makefile @@ -32,9 +32,9 @@ DEFINES =-DDEBUG XENINC =-I$(XEN_ROOT)/tools/libxc # Disable PIE/SSP if GCC supports them. They can break us. -CFLAGS += $(call test-gcc-flag,$(CC),-nopie) -CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector) -CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector-all) +CFLAGS += $(call cc-option,$(CC),-nopie,) +CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) +CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) OBJCOPY = objcopy CFLAGS += $(DEFINES) -I. $(XENINC) -fno-builtin -O2 -msoft-float diff --git a/tools/firmware/vmxassist/Makefile b/tools/firmware/vmxassist/Makefile index 1f441a12c3..70f7a0e0a3 100644 --- a/tools/firmware/vmxassist/Makefile +++ b/tools/firmware/vmxassist/Makefile @@ -32,9 +32,9 @@ DEFINES=-DDEBUG -DTEXTADDR=$(TEXTADDR) XENINC=-I$(XEN_ROOT)/tools/libxc # Disable PIE/SSP if GCC supports them. They can break us. -CFLAGS += $(call test-gcc-flag,$(CC),-nopie) -CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector) -CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector-all) +CFLAGS += $(call cc-option,$(CC),-nopie,) +CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) +CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) CPP = cpp -P OBJCOPY = objcopy -p -O binary -R .note -R .comment -R .bss -S --gap-fill=0 diff --git a/tools/ioemu/Makefile.target b/tools/ioemu/Makefile.target index b216e6acaf..c80cb586c4 100644 --- a/tools/ioemu/Makefile.target +++ b/tools/ioemu/Makefile.target @@ -23,7 +23,7 @@ VPATH+=:$(SRC_PATH)/linux-user DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH) endif CFLAGS+=-Wall -O2 -g -fno-strict-aliasing -SSE2 := $(call test-gcc-flag,$(CC),-msse2) +SSE2 := $(call cc-option,$(CC),-msse2,) ifeq ($(SSE2),-msse2) CFLAGS += -DUSE_SSE2=1 -msse2 endif diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk index 33eb5b53a4..fd1a52e365 100644 --- a/xen/arch/x86/Rules.mk +++ b/xen/arch/x86/Rules.mk @@ -11,26 +11,26 @@ HAS_VGA := y pae ?= n supervisor_mode_kernel ?= n -CFLAGS += -nostdinc -fno-builtin -fno-common -fno-strict-aliasing -CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe -CFLAGS += -I$(BASEDIR)/include -CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic -CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default +CFLAGS += -nostdinc -fno-builtin -fno-common -fno-strict-aliasing +CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe +CFLAGS += -I$(BASEDIR)/include +CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic +CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default # Prevent floating-point variables from creeping into Xen. -CFLAGS += -msoft-float +CFLAGS += -msoft-float # Disable PIE/SSP if GCC supports them. They can break us. -CFLAGS += $(call test-gcc-flag,$(CC),-nopie) -CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector) -CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector-all) +CFLAGS += $(call cc-option,$(CC),-nopie,) +CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) +CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) ifeq ($(TARGET_SUBARCH)$(pae),x86_32y) -CFLAGS += -DCONFIG_X86_PAE=1 +CFLAGS += -DCONFIG_X86_PAE=1 endif ifeq ($(supervisor_mode_kernel),y) -CFLAGS += -DCONFIG_X86_SUPERVISOR_MODE_KERNEL=1 +CFLAGS += -DCONFIG_X86_SUPERVISOR_MODE_KERNEL=1 endif ifeq ($(XEN_TARGET_ARCH),x86_32) @@ -39,11 +39,11 @@ x86_64 := n endif ifeq ($(TARGET_SUBARCH),x86_64) -CFLAGS += -mno-red-zone -fpic -fno-reorder-blocks -CFLAGS += -fno-asynchronous-unwind-tables +CFLAGS += -mno-red-zone -fpic -fno-reorder-blocks +CFLAGS += -fno-asynchronous-unwind-tables # -fvisibility=hidden reduces -fpic cost, if it's available -CFLAGS += $(shell $(CC) -v --help 2>&1 | grep " -fvisibility=" | \ - grep -q hidden && echo "-DGCC_HAS_VISIBILITY_ATTRIBUTE") +CFLAGS += $(call cc-option,$(CC),-fvisibility=hidden,) +CFLAGS := $(subst -fvisibility=hidden,-DGCC_HAS_VISIBILITY_ATTRIBUTE,$(CFLAGS)) x86_32 := n x86_64 := y endif